#include "testsummator.h"
#include <QtTest/QtTest>

TestSummator::TestSummator()
{
    m_sum=new Summater(this);
    m_sum->setA(3);
    m_sum->setB(15);
}

void TestSummator::test_SetA()
{
    m_sum->setA(10);
    QCOMPARE(m_sum->sum(), 24);
}

void TestSummator::test_Sum()
{
    m_sum->setA(7);
    m_sum->setB(15);
    QCOMPARE(m_sum->sum(), 22);
}

void TestSummator::test_valueChanged()
{
    QSignalSpy spy(m_sum, SIGNAL(Summater::valueChanged()));
    m_sum->setA(0);
    m_sum->setB(0);

    QCOMPARE(spy.count(),2);
}
